<?php
include_once 'model/user/user_create.php';

$user = new users();
$result = $user->select();
?>
<div id="content">
    <h2 class="jquery_tab_title"><?php echo $phrase["manager_user"] ?></h2>
    <span class="bglink"><a class="link" href="<?= $url["home"] ?>/menu/create"><?php echo $phrase["create"] ?></a></span>
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
            <tr>
                <th width="20%"><?php echo $phrase["username"] ?></th>
                <th width="20%"><?php echo $phrase["fullname"] ?></th>
                <th width="20%"><?php echo $phrase["email"] ?></th>
                <th width="11%"><?php echo $phrase["phone"] ?></th>
                <th width="11%"><?php echo $phrase["registered"] ?></th>
                <td class="status" width="8%"></td>
            </tr>
        </thead>
        <tbody>
            <?php
            while ($rows = mysql_fetch_array($result)) {
                $date = new DateTime($rows["user_registered"]);
                $i++;
                ?>
                <tr class="gradeC">
                    <td><?php echo $rows["user_name"] ?></td>
                    <td><?php echo $rows["user_fullname"] ?></td>
                    <td><?php echo $rows["user_email"] ?></td>
                    <td><?php echo $rows["user_phone"] ?></td>
                    <td><?php echo $date->format("d/m/Y") ?></td>
                    <?php if ($i % 2) { ?>
                        <td class="first">
                            <a href="<?= $url["home"] ?>/menu/update/id/<?php echo $rows["user_id"] ?>">
                                <image src="<?= $url["home"] ?>/images/icons/edit-icon.gif"/>
                            </a>
                            | 
                            <a href="<?= $url["home"] ?>/menu/delete/id/<?php echo $rows["user_id"] ?>" onclick="return confirm('Bạn có chắc chắn muốn xóa không.');">
                                <image src="<?= $url["home"] ?>/images/icons/b_drop.png"/>
                            </a>
                        </td>
                    <?php } else { ?>
                        <td class="last">
                            <a href="<?= $url["home"] ?>/menu/update/id/<?php echo $rows["user_id"] ?>">
                                <image src="<?= $url["home"] ?>/images/icons/edit-icon.gif"/>
                            </a>
                            | 
                            <a href="<?= $url["home"] ?>/menu/delete/id/<?php echo $rows["user_id"] ?>" onclick="return confirm('Bạn có chắc chắn muốn xóa không.');">
                                <image src="<?= $url["home"] ?>/images/icons/b_drop.png"/>
                            </a>
                        </td>
                    <?php } ?>
                </tr>
            <?php } ?>
        </tbody>
        <tfoot>
            <tr>
                <th colspan="6"></th>
            </tr>
        </tfoot>
    </table>
<!--    <a href="<?= $url["home"] ?>/menu/update/id/<?php echo $rows["user_id"] ?>"><?php echo $phrase["update"] ?></a>|
    <a href="<?= $url["home"] ?>/menu/delete/id/<?php echo $rows["user_id"] ?>" onclick="return confirm('Bạn có chắc chắn muốn xóa không.');"><?php echo $phrase["delete"] ?></a>-->
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('#example').dataTable({
            "sPaginationType": "full_numbers"
        });
    } );
</script>